/////////////////////////////////////////////////////////
// Manager_Texture.h
// Texture Manager of GL textures
//
/////////////////////////////////////////////////////////

#ifndef _MANAGER_TEXTURE
#define _MANAGER_TEXTURE

#include "..\framework\Frm_Manager.h"
#include "..\ToolBox\IOTexture_BMP.h"
#include "..\ToolBox\TBox_Textures.h"

#define TXTMGR_NOTEXTURE	65535

typedef struct {
	std::string Name;
   uchar TargetType;
   GLuint ID;
} Texture;

class Manager_Texture: public Frm::Manager<Texture*> {
	public:
   	Manager_Texture(void):Frm::Manager<Texture*>(), _TargetType(TXT_RGB){_TargetType=TXT_RGB;};
      ~Manager_Texture(void);
   	void SetTargetType(uchar &pTargetType){_TargetType = pTargetType;};
      void SetTranspColor(uchar pr, uchar pg, uchar pb){_Convert.SetTranspColor(pr, pg, pb);};
		bool Load(std::string &pFileName);
      bool Unload(uint16 pIndex);
      void Reset(void);
      uint16 SetTexture(std::string &pFileName);
      const GLuint GetID(uint16 pIndex){return _Ts[pIndex]->ID;};

   protected:
      Frm::IO<TEXTURE>* IOStrategy;// load/save methods
  		TEXTURE _Texture;       //buffer used to load/save or transform textures
      Texture* _TextStruct;   //structure holding the name, target type and GL ID
      uchar _TargetType;

      ToolBox::ConvText _Convert;

      bool check(std::string &pFileName);
      bool Create(void);
};


#endif
